package Strategy;

public class Context {
    private Strategy strategy; //维持一个对抽象策略类的引用

    //注入策略对象
    public void setStrategy(Strategy strategy) {
        this.strategy= strategy;
    }

    //调用策略类中的算法
    public void algorithm() {
        strategy.algorithm();
    }
}

